<!--通用模板-->
<div id="iframe-box">
</div>
<script>
    function urlChangeTable(url) {
        // 替换/%2F/g,"/"
        let urlRet = '';
        if (url) {
            urlRet = url.replace(/%2FF/g, "/");
            urlRet = urlRet.replace(/%3DD/g, "=");

        }
        return urlRet
    }

    layui.use([], function () {
            let $ = layui.$,
                _iframeUrl = layui.router().search
            let iframeUrl = urlChangeTable(_iframeUrl.iframe)
            debugger
            // console.log(iframeUrl)
            if (iframeUrl.indexOf('filename') !== -1) {
                // iframeUrl = layui.setter.biHost + iframeUrl + '&uid=' + 'admin' + '&pwd=' + 'admin' + '&swjg_dm=' + window.currentUserMsg.haveGW.SWJGDM + '&jcdm=' + window.currentUserMsg.haveGW.JCDM
                let uid = layui.data('layuiAdmin').biInfo.uid;
                let pwd = layui.data('layuiAdmin').biInfo.pwd;
                iframeUrl = layui.setter.biHost + iframeUrl + '&uid=' + uid + '&pwd=' + pwd + '&swjg_dm=' + window.currentUserMsg.haveGW.SWJGDM + '&jcdm=' + window.currentUserMsg.haveGW.JCDM
            }
            // 设置要跳转到的url为类名
            let iframeStr = `<iframe src=${iframeUrl} frameborder="0" class="layadmin-iframe ${iframeUrl}"></iframe>`
            // 先隐藏所有然后新增新的
            // debugger
            let divID = iframeUrl.replace(/\.|\/|:|=|\?|&/g, "");
            // let divID = _iframeUrl;
            $('#iframe-box').attr('id', divID)
            let divSelect = `#${divID}`
            $(divSelect).html(iframeStr)

        }
    )
</script>
